package com.sxt.sys.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sxt.springcloud.sys.PermissionClientService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sxt.sys.common.Constast;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.common.TreeNode;
import com.sxt.sys.domain.Permission;
import com.sxt.sys.vo.PermissionVo;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 老雷
 * @since 2019-09-21
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {

	@Autowired
	private PermissionClientService permissionService;

	/**************** 权限管理开始 ****************/

	/**
	 * 加载权限管理左边的权限树的json
	 */
	@RequestMapping("loadPermissionManagerLeftTreeJson")
	public DataGridView loadPermissionManagerLeftTreeJson( PermissionVo permissionVo) {
		return this.permissionService.loadPermissionManagerLeftTreeJson(permissionVo);
	}

	/**
	 * 查询
	 */
	@RequestMapping("loadAllPermission")
	public DataGridView loadAllPermission( PermissionVo permissionVo) {
		return this.permissionService.loadAllPermission(permissionVo);
	}

	/**
	 * 加载最大的排序码
	 * 
	 * @param
	 */
	@RequestMapping("loadPermissionMaxOrderNum")
	public Map<String, Object> loadPermissionMaxOrderNum() {
		return this.permissionService.loadPermissionMaxOrderNum();
	}

	/**
	 * 添加
	 * 
	 * @param permissionVo
	 * @return
	 */
	@RequestMapping("addPermission")
	public ResultObj addPermission( PermissionVo permissionVo) {
		return this.permissionService.addPermission(permissionVo);
	}

	/**
	 * 修改
	 * 
	 * @param permissionVo
	 * @return
	 */
	@RequestMapping("updatePermission")
	public ResultObj updatePermission( PermissionVo permissionVo) {
		return this.permissionService.updatePermission(permissionVo);

	}

	/**
	 * 删除
	 * 
	 * @param permissionVo
	 * @return
	 */
	@RequestMapping("deletePermission")
	public ResultObj deletePermission( PermissionVo permissionVo) {
		return this.permissionService.deletePermission(permissionVo);
	}

	/**************** 权限管理结束 ****************/

}
